package list;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ListDemo<E> {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
//        CopyOnWriteArrayList
        Random random = new Random();
        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                list.add(random.nextInt(10));
                System.out.println(list);
            }).start();
        }
    }

    public void add(List<? extends E> list ){
        System.out.println(list);
    }

}
